package com.promis.widget.mediapicker.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by dmcBig on 2017/7/4.
 */

public class MediaParcelable implements Parcelable {

    public String localPath;
    public String name;
    public long time;
    public long size;
    public int id;
    public String parentDir;

    public MediaParcelable(String localPath, String name, long time, long size, int id, String parentDir){
        this.localPath = localPath;
        this.name = name;
        this.time = time;
        this.size=size;
        this.id=id;
        this.parentDir=parentDir;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.localPath);
        dest.writeString(this.name);
        dest.writeLong(this.time);
        dest.writeLong(this.size);
        dest.writeInt(this.id);
        dest.writeString(this.parentDir);
    }

    protected MediaParcelable(Parcel in) {
        this.localPath = in.readString();
        this.name = in.readString();
        this.time = in.readLong();
        this.size = in.readLong();
        this.id = in.readInt();
        this.parentDir = in.readString();
    }

    public static final Creator<MediaParcelable> CREATOR = new Creator<MediaParcelable>() {
        @Override
        public MediaParcelable createFromParcel(Parcel source) {
            return new MediaParcelable(source);
        }

        @Override
        public MediaParcelable[] newArray(int size) {
            return new MediaParcelable[size];
        }
    };

//    public boolean image() {
//        if (mediaType == MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE) {
//            return true;
//        } else return false;
//    }
//
//    public boolean video() {
//        if (mediaType == MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO) {
//            return true;
//        } else return false;
//    }
}
